﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Reviewer.Entities;
using System.ServiceModel;
using System.Net.Security;
using System.Collections.ObjectModel;

namespace Reviewer.Entities.Services
{
    /// <summary>
    /// Review Service Interface
    /// </summary>
    [ServiceContract(Namespace = "Reviewer.Services")]
    public interface IReviewService : IDisposable
    {
        /// <summary>
        /// Gets all reviews.
        /// </summary>
        /// <returns></returns>
        Collection<Review> Find();

        /// <summary>
        /// Finds the specified review by id.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        [OperationContract]
        Review Find(int id);

        /// <summary>
        /// Finds the specified game.
        /// </summary>
        /// <param name="gameTitle">The game title.</param>
        /// <param name="gameFormat">The game format.</param>
        /// <param name="gameGenre">The game genre.</param>
        /// <param name="reviewAuthor">The review author.</param>
        /// <param name="distributor">The distributor.</param>
        /// <returns></returns>
        [OperationContract]
        Collection<ReviewSearchResult> Search(String gameTitle, Int32? gameFormat, Int32? gameGenre, Int32? reviewAuthor, Int32? distributor, Int32? maxResults);

        /// <summary>
        /// Gets the by game id.
        /// </summary>
        /// <param name="gameId">The game id.</param>
        /// <returns></returns>
        [OperationContract]
        Collection<Review> FindByGameId(int gameId);

        /// <summary>
        /// Finds the latest.
        /// </summary>
        /// <param name="count">The count.</param>
        /// <returns></returns>
        [OperationContract]
        Collection<Review> FindLatest(int count);

    }

    /// <summary>
    /// Review Administration Service Interface
    /// </summary>
    [ServiceContract(Namespace = "Reviewer.Services")]
    public interface IReviewAdminService : IReviewService
    {
        /// <summary>
        /// Creates the specified new Review item.
        /// </summary>
        /// <param name="ReviewItem">The Review item.</param>
        /// <returns>Created <c ref="Review"/> item</returns>
        [OperationContract]
        Review Save(Review review);

        /// <summary>
        /// Deletes the specified deleted Review item.
        /// </summary>
        /// <param name="ReviewItem">The deleted Review item.</param>
        /// <returns><c ref="True" /> if deleted otherwise <c ref="False" /></returns>
        [OperationContract]
        bool Delete(Review review);

        /// <summary>
        /// Deletes the Review by id.
        /// </summary>
        /// <param name="id">The Review id.</param>
        /// <returns><c ref="True" /> if deleted otherwise <c ref="False" /></returns>
        [OperationContract]
        bool DeleteById(int id);

        /// <summary>
        /// Deletes the by game id.
        /// </summary>
        /// <param name="gameId">The game id.</param>
        /// <returns></returns>
        [OperationContract]
        bool DeleteByGameId(int gameId);
    }
}
